package a02_Thread;

/**
 * @Author quan
 * @Description 获取线程的名字
 * @Date 2023/4/28 11:34
 */
public class Demo2_ThreadName {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            while (true){
                System.out.println("Thread打印名字..."+ Thread.currentThread().getName());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"我的名字是线程");
        t.start();
    }
}
